#include<iostream>
#include<vector>
using namespace std;


int pivotIndex(vector<int>& nums) {
    int len = nums.size();
    vector<int> f(len), g(len);
    for (int i = 1, j = len - 2; i < len && j >= 0; i++, j--)
    {
        f[i] = f[i - 1] + nums[i];
        g[j] = g[j + 1] + nums[j];
    }
    for (int i = 0; i < len; i++)
    {
        if (f[i] == g[i]) return i;
    }

    return -1;
}


int main()
{
    vector<int> v = { 1,7,3,6,5,6 };

    pivotIndex(v);

	return 0;
}
